#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <set>
#include <cstdio>

using namespace std;

struct team {
    string name;
    string part;
};

struct group {
    set<string> parts;
    set<string> names;
    set<int> korsiny;
};

bool solve(int ii, int jj, vector<vector<team> > &teams, vector<group> &groups, int g, int t) {
    for (int i = 0; i < g; i++) {
        if (groups[i].korsiny.find(ii) == groups[i].korsiny.end() && groups[i].parts.find(teams[ii][jj].part) == groups[i].parts.end()) {
            groups[i].korsiny.insert(ii);
            groups[i].parts.insert(teams[ii][jj].part);
            groups[i].names.insert(teams[ii][jj].name);
            if (ii == t && jj == g) {
                cout << "Yes" << endl;
                for (int i1 = 0; i1 < g; ++i1) {
                    cout << endl;
                    for (set<string>::const_iterator iter = groups[i1].names.begin(); iter != groups[i1].names.end(); ++iter) {
                        cout << *iter << endl;
                    }
                }
                return true;
            }
            int ii_new = (ii*g +jj + 1) / g;
            int jj_new = (ii*g +jj + 1) % g;
            if (solve(ii_new, jj_new, teams, groups, g, t))
                return true;
            groups[i].korsiny.erase(ii);
            groups[i].parts.erase(teams[ii][jj].part);
            groups[i].parts.erase(teams[ii][jj].name);
        }
    }

    return false;
}


int main() {
//    #ifndef ONLINE_JUDGE
//        freopen("input", "rt", stdin);
//        freopen("output", "wt", stdout);
//    #endif

    int g, t;
    cin >> g >> t;
    vector<vector<team> > teams(t, vector<team>(g));
    for (int i = 0; i < t; ++i) {
        for (int j = 0; j < g; ++j) {
            string name;
            string part;
            cin >> name;
            cin >> part;
            teams[i][j].name = name;
            teams[i][j].part = part;
        }
    }

    vector<group> groups(g);
    if (!solve(0, 0, teams, groups, g, t)) {
        cout << "No" << endl;
    }
}
